package com.dev.mybatisplus.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 测试表
 * @author admin
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@TableName("test")
@ApiModel("测试表")
public class Test implements Serializable {

    /**
     * 主键
     */
    @TableId(value = "test_id", type = IdType.AUTO)
    @NotNull(message = "主键不能为空!", groups = {Update.class})
    @ApiModelProperty(value = "主键", required = true, allowEmptyValue = false)
    private Integer testId;

    /**
     * 姓名
     */
    @Size(min = 0, max = 255, message = "姓名长度不能超过255", groups = {Insert.class, Update.class})
    @ApiModelProperty(value = "姓名", required = false , allowEmptyValue = true)
    private String name;

    /**
     * 地址
     */
    @Size(min = 0, max = 20, message = "地址长度不能超过20", groups = {Insert.class, Update.class})
    @ApiModelProperty(value = "地址", required = false , allowEmptyValue = true)
    private String address;

    /**
     * 联系电话
     */
    @Size(min = 0, max = 20, message = "联系电话长度不能超过20", groups = {Insert.class, Update.class})
    @ApiModelProperty(value = "联系电话", required = false , allowEmptyValue = true)
    private String phone;

    /**
     * 性别
     */
    @Size(min = 0, max = 1, message = "性别长度不能超过1", groups = {Insert.class, Update.class})
    @ApiModelProperty(value = "性别", required = false , allowEmptyValue = true)
    private String sex;

    /**
     * 年龄
     */
    @ApiModelProperty(value = "年龄", required = false , allowEmptyValue = true)
    private Integer age;

    /**
     * 创建日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期", required = false , allowEmptyValue = true)
    private LocalDateTime createTime;

    /**
     * 更新日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期", required = false , allowEmptyValue = true)
    private LocalDateTime updateTime;

}
